home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ColorPickerTest.cp
-
- Contains: TColorPicker is a simple color picker utility class
- TColorPickerTest.cp contains the TColorPicker test function definitions.
-
- Written by: Kent Sandvik
-
- Copyright: Copyright © 1993-1999 by Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
- 8/18/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
-
-
- */
- #ifndef _COLORPICKER
- #include "ColorPicker.h"
- #endif
-
- void main(void)
- {
- cout << "Start of the TColorPicker object test…\n";
-
- // Initialize needed toolbox entries
- ::InitGraf(&qd.thePort);
- ::InitWindows();
- ::InitDialogs(NULL);
-
- // Create a TColor Picker.
- TColorPicker myPicker;
-
- // Select a value, show it three times to check out that it remembers the color.
- for (int i = 0; i < 3; i++)
- myPicker.Select("\pI want a color, pleaaaase");
-
- // Show RGB values from last selection.
- cout << "Last selected RGB has the following values: \n";
- RGBColor foo = myPicker.GetSelectedColor();
- cout << foo.red << " " << foo.green << " " << foo.blue << "\n";
-
- // Show CMY values from last selection.
- CMYColor myCMY = myPicker.GetSelectedCMYColor();
- cout << "Last selected RGB has the following CMY values: \n";
- cout << myCMY.cyan << " " << myCMY.magenta << " " << myCMY.yellow << "\n";
-
- // Show HSL values from last selection.
- HSLColor myHSL = myPicker.GetSelectedHSLColor();
- cout << "Last selected RGB has the following HSL values: \n";
- cout << myHSL.hue << " " << myHSL.saturation << " " << myHSL.lightness << "\n";
-
- // Show HSV values from last selection.
- HSVColor myHSV = myPicker.GetSelectedHSVColor();
- cout << "Last selected RGB has the following HSV values: \n";
- cout << myHSV.hue << " " << myHSV.saturation << " " << myHSV.value << "\n";
-
- // Reset and show the picker once again.
- myPicker.Reset();
- myPicker.Select();
-
- // Create a plain color picker that neith.er keeps track of original value, neither has a string.
- // for the dialog message.
- TColorPicker plainOne(false);
- for (int j = 0; j < 3; j++)
- plainOne.Select("\p");
-
- cout << "End of the TColorPicker object test!\n";
- }
-
- // _________________________________________________________________________________________________________ //
-
- /* Change History (most recent last):
- No Init. Date Comment
- 1 khs 1/3/93 New file
- 2 khs 1/5/93 Cleanup
- */
-